package org.keyyond.ms.scheduler.service.impl;

import org.keyyond.ms.core.util.HttpUtil;
import org.keyyond.ms.scheduler.service.MsEsbDcpProjService;
import org.keyyond.ms.scheduler.util.EncryptUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class MsEsbDcpProjServiceImpl implements MsEsbDcpProjService {
    
    private static Logger logger = LoggerFactory.getLogger(MsEsbDcpProjServiceImpl.class);
        
    @Value("${sendProjToNcUrl}")
    private String sendProjToNcUrl;
    
    @Value("${authParam}")
    private String authParam;

    @Override
    public String sendProjByPageToNc() {
	String encrypt = EncryptUtil.encrypt(authParam);
	String result = null;
	if (encrypt != null) {
	    logger.info("项目推送开始！");
	    result = HttpUtil.sendPost(sendProjToNcUrl + encrypt, "{}", "UTF-8");
	} else {
	    logger.info("没有权限！");
	}
	return result;
    }

}
